package com.sample.tdf.api;

import cn.com.taiji.common.api.BaseTreeController;
import cn.com.taiji.common.dto.ResultDTO;
import com.sample.tdf.dto.OrgEmpsDTO;
import com.sample.tdf.dto.OrganizationDTO;
import com.sample.tdf.service.IOrganizationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = {"机构操作接口"})
@RequestMapping("/homework/org")
public class OrganizationController extends BaseTreeController<IOrganizationService, OrganizationDTO> {
    @Autowired
    private IOrganizationService iOrganizationService;

    @GetMapping("/find-org-emp-tree-by-id")
    @ApiOperation(value = "根据机构id查询员工，并且拼接为树结构")
    public ResultDTO findOrgEmpTreeById(String orgId) {
        List<OrgEmpsDTO> empOrgDTOs = iOrganizationService.findOrgEmpTreeById(orgId);
        return new ResultDTO(empOrgDTOs);
    }
}
